
package com.rt.schedulenew.web;

import com.rt.schedulebase.dto.DictSysparamsDto;
import org.springframework.web.bind.annotation.PostMapping;
import com.rt.schedulenew.utils.global.JsonResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import com.rt.schedulenew.api.IDictSysparamsService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping({"/config"})
public class ConfigController {
    @Autowired
    private IDictSysparamsService dictSysparamsService;

    /**
     * 获取系统配置信息
     * @param dto
     * @return
     */
    @PostMapping({"/getConfigInfo"})
    public JsonResult getConfigInfo(@RequestBody DictSysparamsDto dto) {
        JsonResult jsonResult = dictSysparamsService.getConfigInfo(dto);
        return jsonResult;
    }

    /**
     * 保存系统配置
     * @param dto
     * @return
     */
    @PostMapping({"/saveConfig"})
    public JsonResult saveConfig(@RequestBody DictSysparamsDto dto) {
        JsonResult jsonResult = dictSysparamsService.saveConfig(dto);
        return jsonResult;
    }

    /**
     * 获取界面配置-根据用户
     *
     * @param dto
     * @return
     */
    @PostMapping({"/getCustomSet"})
    public JsonResult getCustomSet(@RequestBody DictSysparamsDto dto) {
        JsonResult jsonResult = dictSysparamsService.getCustomSetByUserId(dto);
        return jsonResult;
    }

    @PostMapping({"/saveCustomSet"})
    public JsonResult saveCustomSet(@RequestBody DictSysparamsDto dto) {
        JsonResult jsonResult = dictSysparamsService.saveCustomSetByUserId(dto);
        return jsonResult;
    }
}
